package com.heima.admin.controller.v1;

import com.heima.admin.service.AdSensitiveService;
import com.heima.model.admin.dtos.SensitiveDto;
import com.heima.model.admin.pojos.AdSensitive;
import com.heima.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author zhangyan
 * @date 2021/4/23 21:18
 */
@RestController
@RequestMapping("/api/v1/sensitive")
@Api(value = "敏感词管理", tags = "敏感词管理", description = "敏感词管理API")
public class AdSensitiveController {

    @Autowired
    private AdSensitiveService sensitiveService;

    @PostMapping("/list")
    @ApiOperation("敏感词分页列表查询")
    public ResponseResult list(@RequestBody SensitiveDto dto){
        return sensitiveService.list(dto);
    }

    @PostMapping("/save")
    @ApiOperation("敏感词新增")
    public ResponseResult insert(@RequestBody AdSensitive adSensitive){
        return sensitiveService.insert(adSensitive);
    }

    @PostMapping("/update")
    @ApiOperation("敏感词更新")
    public ResponseResult update(@RequestBody AdSensitive adSensitive){
        return sensitiveService.update(adSensitive);
    }

    @DeleteMapping("/del/{id}")
    @ApiOperation("敏感词删除")
    public ResponseResult deleteById(@PathVariable("id") Integer id){
        return sensitiveService.deleteById(id);
    }
}
